package personal.wang.util;

import io.netty.util.internal.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import personal.wang.utils.StringUtils;

import java.util.Properties;

/**
 * @className: ParameterUtil
 * @Description:
 * @Author: wangyifei
 * @Date: 2025/2/19 11:18
 */
public class ParameterUtil {
    private static final Logger logger = LoggerFactory.getLogger(ParameterUtil.class);
    public static final String previosParameter = "--" ;
    public static Properties fromArgument(String[] args){
        Properties properties = new Properties();
        for (int i = 0; i < args.length; i = i + 2) {
            if(i+1 < args.length && args[i].startsWith(previosParameter)){
                properties.put(args[i].replace(previosParameter, StringUtil.EMPTY_STRING) , args[i+1]);
            }
        }
        return properties;
    }
}
